package com.tedu.openmedical.medicalsystem.send.controller;

import com.tedu.openmedical.base.response.JsonResult;
import com.tedu.openmedical.medicalsystem.send.service.VerificationCodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/v1/sms/")
@Slf4j
@Api(tags = "短信验证码")
public class SendVerController {

    @Autowired
    private VerificationCodeService verificationCodeService;

    @PostMapping("send/{phone}")
    @ApiOperation(value = "发送短信验证码", notes = "发送短信验证码")
    public JsonResult sendVerificationCode(@PathVariable("phone") String phone) {
        log.debug("发送短信验证码，手机号：{}", phone);
        verificationCodeService.sendSms(phone);
        return JsonResult.ok();
    }
}
